package lab

// Uniq 去除数组中的重复元素，返回一个新数组
func Uniq[T comparable](array []T) []T {
	seen := make(map[T]bool)
	var result []T
	for _, v := range array {
		if false == seen[v] {
			result = append(result, v)
			seen[v] = true
		}
	}
	return result
}
